<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <span></span>
    <script>
        var divEle = document.querySelector('span');
        function getAutoDate() {
            var d1 = new Date();
            var year = d1.getFullYear();
            var d = d1.getDate() >= 10 ? d1.getDate() : "0" + d1.getDate();
            var m = (d1.getMonth() + 1) >= 10 ? (d1.getMonth() + 1) : "0" + (d1.getMonth() + 1);
            var h = d1.getHours() >= 10 ? d1.getHours() : "0" + d1.getHours();
            var mi = d1.getMinutes() >= 10 ? d1.getMinutes() : "0" + d1.getMinutes();
            var s = d1.getSeconds() >= 10 ? d1.getSeconds() : "0" + d1.getSeconds();
            var arr = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
            var str =  year + "-" + m + "-" + d+' '+arr[d1.getDay()] + " " + h + ":" + mi + ":" + s  
            divEle.innerHTML = str;
            setTimeout(getAutoDate,1000)
        }
            getAutoDate()
    </script>
    </body>
    </html>
